package com.zjuee.web.company.service.impl.handledata;

import com.zjuee.core.translation.handledata.impl.AbstractDataHandler;
import com.zjuee.service.company.vo.CompanyWorkDepositoryVo;
import com.zjuee.base.model.common.company.CompanyWorkDepository;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author wu liang
 * @since 2020/10/14 9:57
 */
@Component(value = "corpWorkDepositoryHandle")
public class CorpWorkDepositoryHandle extends AbstractDataHandler {

    @Override
    public <T> T getData(T data, Map<Object, Object> map, String... str) {
        CompanyWorkDepository companyWorkDepository = (CompanyWorkDepository) data;
        CompanyWorkDepositoryVo companyWorkDepositoryVo = new CompanyWorkDepositoryVo();
        BeanUtils.copyProperties(companyWorkDepository, companyWorkDepositoryVo);
        companyWorkDepositoryVo.setNameCN(map.get(companyWorkDepository.getBcwdName() + str[0]) == null?"" : map.get(companyWorkDepository.getBcwdName() + str[0]).toString());
        companyWorkDepositoryVo.setTypeCN(map.get(companyWorkDepository.getBcwdType() + str[1]) == null?"" : map.get(companyWorkDepository.getBcwdType() + str[1]).toString());


        return (T) companyWorkDepositoryVo;
    }
}
